<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      D.10.&nbsp;/etc/rc.d/init.d/mountfs
    </title>
    <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="lfs" id="lfs-7.3">
    <div class="navheader">
      <h4>
        Linux From Scratch - Version 7.3
      </h4>
      <h3>
        Appendix&nbsp;D.&nbsp;Boot and sysconfig scripts version-20130123
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="apds09.html" title=
          "/etc/rc.d/init.d/checkfs">Prev</a>
          <p>
            /etc/rc.d/init.d/checkfs
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="apds11.html" title=
          "/etc/rc.d/init.d/udev_retry">Next</a>
          <p>
            /etc/rc.d/init.d/udev_retry
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="scripts.html" title=
          "Appendix&nbsp;D.&nbsp;Boot and sysconfig scripts version-20130123">
          Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Linux From Scratch - Version 7.3">Home</a>
        </li>
      </ul>
    </div>
    <div class="wrap" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="mountfs" name="mountfs"></a>D.10. /etc/rc.d/init.d/mountfs
      </h1>
      <pre class="screen">
#!/bin/sh
########################################################################
# Begin mountfs
#
# Description : File System Mount Script
#
# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
#               DJ Lucas - dj@linuxfromscratch.org
# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version     : LFS 7.0
#
########################################################################

### BEGIN INIT INFO
# Provides:            $local_fs
# Required-Start:      udev checkfs
# Should-Start:
# Required-Stop:       swap
# Should-Stop:
# Default-Start:       S
# Default-Stop:        0 6
# Short-Description:   Mounts/unmounts local filesystems defined in /etc/fstab.
# Description:         Remounts root filesystem read/write and mounts all
#                      remaining local filesystems defined in /etc/fstab on
#                      start.  Remounts root filesystem read-only and unmounts
#                      remaining filesystems on stop.
# X-LFS-Provided-By:   LFS
### END INIT INFO

. /lib/lsb/init-functions

case "${1}" in
   start)
      log_info_msg "Remounting root file system in read-write mode..."
      mount -n -o remount,rw / &gt;/dev/null
      evaluate_retval

      # Remove fsck-related file system watermarks.
      rm -f /fastboot /forcefsck

      log_info_msg "Recording existing mounts in /etc/mtab..."
      &gt; /etc/mtab

      mount -f /     || failed=1
      mount -f /proc || failed=1
      mount -f /sys  || failed=1
      mount -f /run  || failed=1
      mount -f /dev  || failed=1
      (exit ${failed})
      evaluate_retval

      # This will mount all filesystems that do not have _netdev in
      # their option list.  _netdev denotes a network filesystem.

      log_info_msg "Mounting remaining file systems..."
      mount -a -O no_netdev &gt;/dev/null
      evaluate_retval
      exit $failed
      ;;

   stop)
      # Don't unmount tmpfs like /run
      log_info_msg "Unmounting all other currently mounted file systems..."
      umount -a -d -r -t notmpfs,nosysfs,nodevtmpfs,noproc &gt;/dev/null
      evaluate_retval

      # Make all LVM volume groups unavailable, if appropriate
      # This fails if swap or / are on an LVM partition
      #if [ -x /sbin/vgchange ]; then /sbin/vgchange -an &gt; /dev/null; fi
      ;;

   *)
      echo "Usage: ${0} {start|stop}"
      exit 1
      ;;
esac

# End mountfs
</pre>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="apds09.html" title=
          "/etc/rc.d/init.d/checkfs">Prev</a>
          <p>
            /etc/rc.d/init.d/checkfs
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="apds11.html" title=
          "/etc/rc.d/init.d/udev_retry">Next</a>
          <p>
            /etc/rc.d/init.d/udev_retry
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="scripts.html" title=
          "Appendix&nbsp;D.&nbsp;Boot and sysconfig scripts version-20130123">
          Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Linux From Scratch - Version 7.3">Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
